<link rel="stylesheet" type="text/css" href="css/accourt.css"/>
<link rel="stylesheet" href="css/trecord.css" media="all" />
<link rel="stylesheet" href="css/page.css" media="all" />
<script type="text/javascript" src="js/Calendar.js"></script>
<script type="text/javascript" src="js/global/Date_func.js"></script>
<style>

.acctab td.tL{ text-align:left; padding-left:10px;}
.dname{height:18px; width:200px;}
</style>
<div class="r_content">
	<h3 class="mc_title">
		<span class="mctit_1"><span class="mctit_2">线下充值记录</span></span>
	</h3>
	<div class="accoinfo accos">
		<form id="searchBox">
			<input type="hidden" name="act" id="act" />
			<input type="hidden" name="timeT" id="timeT" value=""/>
			<ul class="search">
				<li class="time">
					<span>&nbsp;&nbsp;&nbsp;分销商：</span>
					<input type="text" class="dname" name="dname" value="<?=$_REQUEST['dname']?>"/>
					<a href="javascript:void(0);" id="excel">导出Excel</a>
				</li>
				<li class="time">
					<span>起止日期：</span>
					<input type="text" name="beginDate" id="begintime" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" value="<?=$_REQUEST['beginDate']?>"/>
					<label>至</label>
					<input type="text" name="endDate"  id="endtime" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" value="<?=$_REQUEST['endDate']?>"/>
					<a title="today" class="<?=$_REQUEST['timeT']=="today"?"current":""?>">今天</a>
					<a title="yesterday" class="<?=$_REQUEST['timeT']=="yesterday"?"current":""?>">昨天</a>
					<a title="week" class="<?=$_REQUEST['timeT']=="week"?"current":""?>">本周</a>
					<a title="lastweek" class="<?=$_REQUEST['timeT']=="lastweek"?"current":""?>">上周</a>
					<a title="month" class="<?=$_REQUEST['timeT']=="month"?"current":""?>">本月</a>
					<a title="lastmonth" class="<?=$_REQUEST['timeT']=="lastmonth"?"current":""?>">上月</a>
					<input type="submit" id="query" value="查询"/>
				</li>
			</ul>
		</form>
	</div>
	<div class="acclist">
		<table class="acctab">
			<thead>
				<tr>
					<th class="tL">交易商户</th>
					<th class="tL">交易时间</th>
					<th></th>
					<th>充值金额</th>
					<th></th>
                    <th class="tR">账户余额</th>
					<th class="tR"></th>
					<th class="tR"></th>
					
					<th class="tR">操作员</th>
					<th class="tR">备注</th>
				</tr>
			 </thead>
			  <tbody id="tbody">
				<?foreach($r as $row){$i++;?>
				<tr class="<?=($i%2==1)?"odd":"even"?>">
					<td class="tL">
                    <?foreach($ainfo as $dinfo){
                        if($dinfo['id']==$row['fid']){
                    ?>
                    <span style="color:red">ID:<?=$dinfo['account']?> </span><?=$dinfo['dname']?>
                    <?}}?>
                    </td>
                    <td title="<?=$row['id']?>"><?=$row['rectime']?></td>
					<td></td>
					<td><?=$row['dmoney']/100?></td>
					<td></td>
                    <td class="lmoney tR"><?=$row['lmoney']/100?></td>
					<td class="income tR"></td>
					<td class="pay tR"></td>
					
					<td class="lmoney tR"><?=$row['operator']?></td>
					<td class="lmoney tR">
                        <?=$row['memo']?>
                    </td>
				</tr>
				<?}?>
			</tbody>
		</table>
		<?if(count($r)!=0){page($count,$currentPage,$pageSize);}?>
	</div>
</div>
<script>
    $(document).ready(function(){
        $("#tbody").on('click','a.show_order_relation', function(){
//            alert($(this).data('order'))
            var td = $(this).parent();
            $.getJSON('call/jh_prod.php',{action:'OrderRelationShip',ordernum:$(this).data('order')})
                    .done(function(json){
                        if (json.status=='ok') {
                            td.html(json.ret);
                        } else {
                            alert(json.msg);
                        }
                    })
        });
    });
	$(".search li.time a").click(function(){
		var title=$(this).attr("title");
		Date_func.selectDate(title,document.getElementById("begintime"),document.getElementById("endtime"));
		$("#timeT").val(title)
		$("#searchBox").submit();
	})
	$(".search li.skey a").click(function(){
		var key=$(this).attr("key");
		$("#"+key).val($(this).attr("kvalue"));
		$("#searchBox").submit();
	})
	$("#excel").click(function(){
		$("#act").val("Export");
		$("form#searchBox").submit();
		$("#act").val("");
	});

</script>